<template>
  <Table
    :columns="columns"
    :page-function="page"
    :save-all-function="saveAll"
  >
  </Table>

</template>

<script>
import {saveAll, page} from '@/api/packageSource'
import Table from '@/components/Table'
import {commonList} from "@/utils/common";
import {list as listPackageGroup} from "@/api/packageGroup";
// import {list as listWordClass} from "@/api/wordClass";

export default {
  name: 'PackageSource',
  components: {Table},
  data() {
    return {
      saveAll: saveAll,
      page: page,
      row: {},
      packageGroup: []
    }
  },
  computed: {
    columns() {
      return [

        {
          prop: 'name',
          label: '名称',
          width: '280',
          type:'url',
          form: {
            key: 'name',
            label: '名称',
            type: 'input',
          }
        }, {
          prop: 'description',
          label: '备注',
          width: '80',
          form: {
            key: 'description',
            label: '备注',
            type: 'input',
          }
        },  {
          prop: 'code',
          label: '包裹号',
          width: '150',
          form: {
            key: 'code',
            label: '包裹号',
            type: 'input',
          }
        },  {
          prop: 'computedPrice',
          label: '单个最低成本',
          width: '120'
        }, {
          prop: 'goodsPrice',
          label: '商品价',
          width: '80',
          form: {
            key: 'goodsPrice',
            label: '商品价',
            type: 'input',
          }
        }, {
          prop: 'weight',
          label: '商品重量',
          width: '80',
          form: {
            key: 'weight',
            label: '商品重量',
            type: 'input',
          }
        }, {
          prop: 'jpFreight',
          label: '日本运费',
          width: '80',
          form: {
            key: 'jpFreight',
            label: '日本运费',
            type: 'input',
          }
        }, {
          prop: 'goodsCount',
          label: '商品数量',
          width: '80',
          form: {
            key: 'goodsCount',
            label: '商品数量',
            type: 'input',
          }
        },
        {
          prop: 'url',
          label: '链接',
          width: '180',
          form: {
            key: 'url',
            label: '链接',
            type: 'input',
          }
        },
        {
          prop: 'id',
          label: '序号',
          width: '80',
          type:"hidden",
          form: {
            key: 'id',
            label: 'id',
          },
        },
        // {
        //   prop: 'length',
        //   label: '长',
        //   width: '80',
        //   form: {
        //     key: 'length',
        //     label: '长',
        //     type: 'input',
        //   }
        // }, {
        //   prop: 'width',
        //   label: '宽',
        //   width: '80',
        //   form: {
        //     key: 'width',
        //     label: '宽',
        //     type: 'input',
        //   }
        // }, {
        //   prop: 'height',
        //   label: '高',
        //   width: '80',
        //   form: {
        //     key: 'height',
        //     label: '高',
        //     type: 'input',
        //   }
        // },
        {
          prop: 'packageGroup.name',
          label: '组合',
          width: '80',
          form: {
            key: 'groupId',
            label: '组合',
            type: 'select',
            options: this.packageGroup
          }
        },
        {
          prop: 'imageURL',
          label: '图片',
          width: '200',
          type: 'image',
          form: {
            key: 'imageURL',
            label: '图片',
            type: 'image'
          }
        },
        // {
        //   prop: 'createTime',
        //   label: '创建时间',
        //   width: '100px'
        // },
        // {
        //   prop: 'updateTime',
        //   label: '更新时间',
        //   width: '100px'
        // },
        {
          label: '操作',
          type: 'action',
          buttons: []
        }
      ]
    }
  },
  beforeMount() {
    this.list()
  },
  methods: {
    list() {
      commonList(this.packageGroup, listPackageGroup, false)
    }
  }
}
</script>

<style scoped>

</style>
